<?php	include_once('../config/db.php');
		include_once('../functions/item.php');
if(!isset($_SESSION['e_logged_in'])) {
header('location:login.php');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../style.css" type="text/css"/>
<title>Online Reservation System</title>
</head>
<body>
<div id="header">
<div id="logo">
  <p>&nbsp;</p>
  <div id="apDiv1"><img src="../image/logo.png" alt="" width="500" height="100" /></div>
  <p>&nbsp;</p>
</div>
</div>
<div id="con-body">
<?php include 'navigation.php';?>
<div id="search">
<form id="form1" name="form1" method="post" action="">
   <label for="textfield"></label>
   <input type="text" name="textfield" id="textfield" />
   <input name="button" type="submit" class="blue" id="button" value="Track Materials" />
 </form>
</div>
<p>List of laboratory materias</p>
<p>
<?php 
$item_id=$_GET['item_id'];
$query=mysql_query("SELECT * FROM item WHERE item_id='$item_id'");
?>
<?php while($row=mysql_fetch_array($query)){?>
<form id="form2" name="form2" method="post" action="">
  <p>
    <label for="item_name"></label>
    Item Name: 
    <input type="text" name="item_name" id="item_name" value="<?php echo $row['item_name'];?>"/>
  </p>
  <p>Item Serial:
    <input type="text" name="item_serial" id="item_serial"  value="<?php echo $row['item_serial'];?>"/>
  </p>
  <p>Item Description:
    <input type="text" name="item_desc" id="item_desc" value="<?php echo $row['item_desc']; ?>"/>
  </p>
  <p>Item: date:
    <input type="text" name="item_date" id="item_date" value="<?php echo $row['item_date'];?>" disabled="disabled"/>
  </p>
	<input type="hidden" name="item_status" id="item_status" value="<?php echo $row['item_status'];?>">
  <p>
    <input type="submit" name="update" id="update" value="Update" />
  </p>
</form><?php } ?>
<?php 
if(isset($_REQUEST['update'])){
	$item_id=$_GET['item_id'];
	$item_name=$_REQUEST['item_name'];
	$item_serial=$_REQUEST['item_serial'];
	$item_desc=$_REQUEST['item_desc'];
	$item_status=$_REQUEST['item_status'];
	$update=mysql_query("UPDATE item SET item_name= '$item_name', item_serial='$item_serial', item_desc='$item_desc', item_status='$item_status' WHERE item_id='$item_id'")
	or die('ERROR:'. mysql_error());
}
?>
</p>
<p>
  <?php //pagination(); ?>
</p>
</div>
 <p>&nbsp;</p>
 <p>&nbsp;</p>
</body>
</html>